import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Login from "../views/Login.vue";
import PostList from "../views/PostList.vue";
import EditPost from "../views/EditPost.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
    meta: {
      breadcrumb: "后台首页",
    },
    children: [
      {
        path: "postlist",
        name: "postList",
        component: PostList,
        meta: {
          breadcrumb: "文章列表",
        },
      },
      {
        path: "editpost",
        name: "EditPost",
        component: EditPost,
        meta: {
          breadcrumb: "发布文章",
        },
      },
    ],
  },
  {
    path: "/login",
    name: "Login",
    component: Login,
  },
];

const router = new VueRouter({
  routes,
});

export default router;
